package Window;
//
public class ChessBean  implements Comparable<ChessBean>{//棋子对象

    private int x; // 棋子横坐标
    private int y;// 棋子纵坐标
    private int orderNumber; // 记录棋子是第几步的  方便后面的显示他的步数是第几步
    private int player;  //棋子颜色，1是黑，二是白,0是无棋子

    private int offense;  //攻击分数
    private int defentse;  //防御分数
    private int sum;   //总分

    private StringBuffer buffer = new StringBuffer();

    //构造方法
    public ChessBean(int x, int y, int player, int orderNumber ){
        super();
        this.x = x;
        this.y = y;
        this.orderNumber = orderNumber;
        this.player = player;
    }

    @Override
    public String toString() {
        return "ChessBean [x=" + x + ", y=" + y + ", orderNumber=" + orderNumber + ", player=" + player + ", offense="
                + offense + ", defentse=" + defentse + ", sum=" + sum + "]";
    }//toString方法被重写，用于返回棋子对象的字符串表示，包括所有属性的值。

    //set 和 get 体现了java面向对象的特性
    public int getOffense() {
        return offense;
    }

    public void setOffense(int offense) {
        this.offense = offense;
    }

    public int getDefentse() {
        return defentse;
    }

    public void setDefentse(int defentse) {
        this.defentse = defentse;
    }

    public int getSum() {
        return sum;
    }

    public void setSum(int sum) {
        this.sum = sum;
    }

    public int getPlayer() {
        return player;
    }

    public void setPlayer(int player) {
        this.player = player;
    }


    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(int orderNumber) {
        this.orderNumber = orderNumber;
    }

    //按照sum值进行排序的 从大到小排序的
    public int compareTo(ChessBean chessBean) {

        if(this.sum>chessBean.sum) {
            return -1;
        }else if(this.sum<chessBean.sum) {
            return 1;
        }else
            return 0;
    }

    public StringBuffer getBuffer() {
        return buffer;
    }

    public void setBuffer(StringBuffer buffer) {
        this.buffer = buffer;
    }

}